// router.js
import {createRouter, createWebHistory} from 'vue-router';
import Login from '@/components/Login.vue';
import Register from "@/components/Register.vue";
import Home from "@/components/Home.vue";
import PatientHome from "@/components/patient/Home.vue"
import DoctorHome from "@/components/doctor/Home.vue"
import PatientManagement from "@/components/doctor/PatientManagement.vue";
import PatientDataStatistics from "@/components/doctor/PatientDataStatistics.vue";

const routes = [
    {path: '/', name: 'Home', component: Home},
    {path: '/login', name: 'Login', component: Login},
    {path: '/register', name: 'Register', component: Register},
    {path: '/patient', name: 'Patient', component: PatientHome},
    {
        path: '/doctor',
        name: 'Doctor',
        component: DoctorHome,
        children: [
            {path: "/doctor/patient_management", component: PatientManagement},
            {path: "/doctor/patient_data_statistics", component: PatientDataStatistics}
        ]
    },
    {path: "/:pathMatch(.*)*", name: "Home", component: Home},
];

// 创建路由实例
const router = createRouter({
    history: createWebHistory(), // 使用HTML5 History模式
    routes
});

export default router;
